3.97 \(\int \sqrt{a+b \cot (c+d x)} (A+B \cot (c+d x)) \, dx\)

Optimal. Leaf size=122 \[ \frac{\sqrt{a-i b} (B+i A) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a-i b}}\right )}{d}-\frac{\sqrt{a+i b} (-B+i A) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a+i b}}\right )}{d}-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d} \]

[Out]

(Sqrt[a - I*b]*(I*A + B)*ArcTanh[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a - I*b]])/d - (Sqrt[a + I*b]*(I*A - B)*ArcTanh
[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a + I*b]])/d - (2*B*Sqrt[a + b*Cot[c + d*x]])/d

________________________________________________________________________________________

Rubi [A]  time = 0.261753, antiderivative size = 122, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 5, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3528, 3539, 3537, 63, 208} \[ \frac{\sqrt{a-i b} (B+i A) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a-i b}}\right )}{d}-\frac{\sqrt{a+i b} (-B+i A) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a+i b}}\right )}{d}-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d} \]

Antiderivative was successfully verified.

[In]

Int[Sqrt[a + b*Cot[c + d*x]]*(A + B*Cot[c + d*x]),x]

[Out]

(Sqrt[a - I*b]*(I*A + B)*ArcTanh[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a - I*b]])/d - (Sqrt[a + I*b]*(I*A - B)*ArcTanh
[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a + I*b]])/d - (2*B*Sqrt[a + b*Cot[c + d*x]])/d

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3539

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[(c
 + I*d)/2, Int[(a + b*Tan[e + f*x])^m*(1 - I*Tan[e + f*x]), x], x] + Dist[(c - I*d)/2, Int[(a + b*Tan[e + f*x]
)^m*(1 + I*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0]
&& NeQ[c^2 + d^2, 0] &&  !IntegerQ[m]

Rule 3537

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[(c*
d)/f, Subst[Int[(a + (b*x)/d)^m/(d^2 + c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] &&
NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]

Rule 63

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - (a*d)/b + (d*x^p)/b)^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rubi steps

\begin{align*} \int \sqrt{a+b \cot (c+d x)} (A+B \cot (c+d x)) \, dx &=-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d}+\int \frac{a A-b B+(A b+a B) \cot (c+d x)}{\sqrt{a+b \cot (c+d x)}} \, dx\\ &=-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d}+\frac{1}{2} ((a-i b) (A-i B)) \int \frac{1+i \cot (c+d x)}{\sqrt{a+b \cot (c+d x)}} \, dx+\frac{1}{2} ((a+i b) (A+i B)) \int \frac{1-i \cot (c+d x)}{\sqrt{a+b \cot (c+d x)}} \, dx\\ &=-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d}-\frac{(i (a-i b) (A-i B)) \operatorname{Subst}\left (\int \frac{1}{(-1+x) \sqrt{a-i b x}} \, dx,x,i \cot (c+d x)\right )}{2 d}+\frac{((i a-b) (A+i B)) \operatorname{Subst}\left (\int \frac{1}{(-1+x) \sqrt{a+i b x}} \, dx,x,-i \cot (c+d x)\right )}{2 d}\\ &=-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d}+\frac{((a-i b) (A-i B)) \operatorname{Subst}\left (\int \frac{1}{-1-\frac{i a}{b}+\frac{i x^2}{b}} \, dx,x,\sqrt{a+b \cot (c+d x)}\right )}{b d}+\frac{((a+i b) (A+i B)) \operatorname{Subst}\left (\int \frac{1}{-1+\frac{i a}{b}-\frac{i x^2}{b}} \, dx,x,\sqrt{a+b \cot (c+d x)}\right )}{b d}\\ &=\frac{\sqrt{a-i b} (i A+B) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a-i b}}\right )}{d}-\frac{\sqrt{a+i b} (i A-B) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a+i b}}\right )}{d}-\frac{2 B \sqrt{a+b \cot (c+d x)}}{d}\\ \end{align*}

Mathematica [A]  time = 0.540601, size = 212, normalized size = 1.74 \[ -\frac{\frac{\left (a A b-a \sqrt{-b^2} B-A \sqrt{-b^2} b+b^2 (-B)\right ) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a-\sqrt{-b^2}}}\right )}{\sqrt{-b^2} \sqrt{a-\sqrt{-b^2}}}-\frac{\left (a A b+a \sqrt{-b^2} B+A \sqrt{-b^2} b+b^2 (-B)\right ) \tanh ^{-1}\left (\frac{\sqrt{a+b \cot (c+d x)}}{\sqrt{a+\sqrt{-b^2}}}\right )}{\sqrt{-b^2} \sqrt{a+\sqrt{-b^2}}}+2 B \sqrt{a+b \cot (c+d x)}}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[Sqrt[a + b*Cot[c + d*x]]*(A + B*Cot[c + d*x]),x]

[Out]

-((((a*A*b - A*b*Sqrt[-b^2] - b^2*B - a*Sqrt[-b^2]*B)*ArcTanh[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a - Sqrt[-b^2]]])/
(Sqrt[-b^2]*Sqrt[a - Sqrt[-b^2]]) - ((a*A*b + A*b*Sqrt[-b^2] - b^2*B + a*Sqrt[-b^2]*B)*ArcTanh[Sqrt[a + b*Cot[
c + d*x]]/Sqrt[a + Sqrt[-b^2]]])/(Sqrt[-b^2]*Sqrt[a + Sqrt[-b^2]]) + 2*B*Sqrt[a + b*Cot[c + d*x]])/d)

________________________________________________________________________________________

Maple [B]  time = 0.044, size = 968, normalized size = 7.9 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*cot(d*x+c))^(1/2)*(A+B*cot(d*x+c)),x)

[Out]

-2*B*(a+b*cot(d*x+c))^(1/2)/d+1/4/d/b*ln(b*cot(d*x+c)+a+(a+b*cot(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2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+2*a)^(1/2)-b*cot(d*x+c)-a-(a^2+b^2)^(1/2))
*B*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)+1/d*b/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan(((2*(a^2+b^2)^(1/2)+2*a)^(1/2)-2*(
a+b*cot(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*A-1/d/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan(((2*(a^2+b^2)
^(1/2)+2*a)^(1/2)-2*(a+b*cot(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))*B*(a^2+b^2)^(1/2)+1/d/(2*(a^2+b^2)^
(1/2)-2*a)^(1/2)*arctan(((2*(a^2+b^2)^(1/2)+2*a)^(1/2)-2*(a+b*cot(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)
)*B*a

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \cot \left (d x + c\right ) + A\right )} \sqrt{b \cot \left (d x + c\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^(1/2)*(A+B*cot(d*x+c)),x, algorithm="maxima")

[Out]

integrate((B*cot(d*x + c) + A)*sqrt(b*cot(d*x + c) + a), x)

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^(1/2)*(A+B*cot(d*x+c)),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (A + B \cot{\left (c + d x \right )}\right ) \sqrt{a + b \cot{\left (c + d x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))**(1/2)*(A+B*cot(d*x+c)),x)

[Out]

Integral((A + B*cot(c + d*x))*sqrt(a + b*cot(c + d*x)), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \cot \left (d x + c\right ) + A\right )} \sqrt{b \cot \left (d x + c\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^(1/2)*(A+B*cot(d*x+c)),x, algorithm="giac")

[Out]

integrate((B*cot(d*x + c) + A)*sqrt(b*cot(d*x + c) + a), x)